const isPregnant = false;

const promise = new Promise((resolve, reject) => {
    if (isPregnant) {
        resolve('孩子他爹');
    } else reject('老公');
});


/*promise.then(name => {
    console.log(`男人成为了${name}`);
}).catch(name => {
    console.log(`男人成为了${name}`);
}).finally(() => console.log("他们结婚了"))*/


/*不用catch也可以捕获reject*/
promise.then(name => {
    console.log(`男人成为了${name}`);
}, name => {
    console.log(`男人成为了${name}`)
});

